# -*- coding: utf-8 -*-

import os,sys, wx 
""" hello wxpython! program."""

class Frame(wx.Frame):#2 子类
    """frame class that display an image """
    def __init__(self,
        image,
        parent=None,
        id=-1,
        pos=wx.DefaultPosition,
        title='Hello,wxPython!'): #3 图像参数
        """ create a frame instance and display image . """
        #4 显示图像
        temp = image.ConvertToBitmap()
        size = temp.GetWidth(),temp.GetHeight()
        
        #size = wx.DefaultSize
        #print size
        #print temp.GetHeight()
        #print temp.GetWidth()
        
        wx.Frame.__init__(self,parent,id,title,pos,size)
        self.bmp = wx.StaticBitmap(parent=self,bitmap=temp)
       
       
       
           
class App(wx.App): #5 
    """ application class. """
    def OnInit(self): 
        #6 图像处理
        image = wx.Image(os.path.dirname(__file__)+'/wxPython.jpg',wx.BITMAP_TYPE_JPEG)
        self.frame = Frame(image)
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True

def main():#7
    app = App()
    app.MainLoop()
    
        
if __name__ == '__main__': 
            

        main()

        
        
        
        
        
        
        
        
        
        